Skip to content

REST API: Add the 'action-trash' link to posts and comments - #14033

Closed
Mamaduka wants to merge 1 commit into
WordPress:trunkfrom
Mamaduka:add/rest-action-trash-link
Closed

Mamaduka wants to merge 1 commit into
WordPress:trunkfrom
Mamaduka:add/rest-action-trash-link

Conversation

@Mamaduka

@Mamaduka Mamaduka commented Oct 6, 2026

Copy link
Copy Markdown
Member

Gutenberg PR: WordPress/gutenberg#84045
Alternative to: #9210.
Trac ticket: https://core.trac.wordpress.org/ticket/63670

PR adds a new wp:action-trash action link to posts and comment endpoints, which can be used to check if the entity allows the trash action.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude
Model(s): Opus 5.5
Used for: Porting the code from the source PR; reviewed by me.

@Mamaduka Mamaduka self-assigned this Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props mamaduka, timothyblynjacobs, adamsilverstein, peterwilsoncc, isabel_brison.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.


$query = new WP_Comment_Query();
$query_result = $query->query( $prepared_args );
$comments = array();

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor fix to satisfy static checks.

add_filter( 'post_password_required', array( $this, 'check_password_required' ), 10, 2 );
}

$posts = array();

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

@Mamaduka
Mamaduka requested a review from peterwilsoncc October 7, 2026 12:51
@Mamaduka
Mamaduka force-pushed the add/rest-action-trash-link branch from f87f501 to e25e60a Compare October 13, 2026 06:39
@TimothyBJacobs

Copy link
Copy Markdown
Member

Did we rule out the possibility of just communicating this with the schema? We should be able to detect using the presence of required on the force option.

@Mamaduka

Copy link
Copy Markdown
Member Author

Did we rule out the possibility of just communicating this with the schema? We should be able to detect using the presence of required on the force option.

I don't think we can use per-record filters (rest_{type}_trashable) at the route level; given their nature, links seem like a good option.

The links are also easy to use in the UI where we render large lists, like DataViews and Notes.

@Mamaduka

Copy link
Copy Markdown
Member Author

Thanks for the review, @TimothyBJacobs!

@adamsilverstein adamsilverstein left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent!

@tellthemachines

Copy link
Copy Markdown
Contributor

Thanks for sorting this out @Mamaduka!

@Mamaduka Mamaduka added the props-bot Adding this label triggers the Props Bot workflow for a PR. label Oct 14, 2026
@github-actions github-actions Bot removed the props-bot Adding this label triggers the Props Bot workflow for a PR. label Oct 14, 2026
@github-actions

Copy link
Copy Markdown

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 64343
GitHub commit: 33ffa46

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions Bot closed this Oct 14, 2026
@Mamaduka
Mamaduka deleted the add/rest-action-trash-link branch October 14, 2026 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants